<?php
/*
 * @Author: 哲学家乔布斯 <wuyangii@qq.com>
 * @Date: 2022-10-25 20:19:21
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-10-25 20:22:43
 * @Descripttion: 
 */


namespace app\common\model;

use think\Model;

class UserOrdersGoods extends Base
{
    protected $insert = ['addtime'];

    //---------------自动完成----------------------
    protected function setAddtimeAttr()
    {
        return time();
    }
    public function getBrandTitleAttr($value,$data){
        return (new \app\common\model\GoodsBrand())->where(['id' => $data['brand_id']])->value('title');
    }
    public function getCarTitleAttr($value,$data){
        return (new \app\common\model\GoodsCar())->where(['id' => $data['car_id']])->value('title');
    }
    public function getGoodsTypeTitleAttr($value,$data){
        return (new \app\common\model\GoodsType())->where(['id' => $data['goods_type_id']])->value('title');
    }
    public function getCateTitleAttr($value,$data){
        return (new \app\common\model\Classify())->where(['id' => $data['cate_id']])->value('name');
    }
    public function getAgentTitleAttr($value,$data){
        return (new \app\common\model\Agent())->where(['id' => $data['agent_id']])->value('title');
    }
    public function getCompanyTitleAttr($value,$data){
        $company_id = (new \app\common\model\Bus())->where(['id' => $data['bus_id']])->value('company_id');
        return (new \app\common\model\Company())->where(['id' => $company_id])->value('title');
    }
    public function getCompanyCodeAttr($value,$data){
        $company_id = (new \app\common\model\Bus())->where(['id' => $data['bus_id']])->value('company_id');
        return (new \app\common\model\Company())->where(['id' => $company_id])->value('code');
    }
  
    
}
